#include <kernel.h>
#include <libk/x86.h>
#include <libk/stdio.h>
#include <libk/string.h>
#include <libk/liballoc.h>

multiboot_info_t * mbd;

void init(unsigned long mdb, unsigned long magic)
{
	if (magic == 0x1BADB002)
	{
		cli();
		hlt();
	}
	//memset((void *) 0xC0000500, 0, 0x7FAFF);
	init_text();
	gdt_install();
	idt_install();
	isrs_install();
	mdb += 0xC0000000;
	mbd = (multiboot_info_t *) mdb;
	parse_mmap(mbd);
	//printf("p1: 0x%x\t\tp2: 0x%x\t\tp3: 0x%x\np4: 0x%x\t\tp5: 0x%x\t\tp6: 0x%x\np7: 0x%x\t\tp8: 0x%x\t\tp9: 0x%x\n", get_phys_page(), get_phys_page(), get_phys_page(), get_phys_page(), get_phys_page(), get_phys_page(), get_phys_page(), get_phys_page(), get_phys_page());
	irq_install();
	set_timer_freq(1000);
	timer_install();
	kb_install();
	sti();
}
